package com.kede.dao;

import com.kede.entity.Role;
import com.kede.entity.UserRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 【请填写作者】
 * @since 2020-04-11
 */
@Repository
public interface UserRoleDao extends BaseMapper<UserRole> {
    @Select("SELECT r.* from role r LEFT JOIN user_role ur ON r.id=ur.role_id WHERE ur.user_id=#{uid}")
    Role getRoleByUid(@Param("uid")Long id);
    @Select("update user_role set role_id=#{roleid} where user_id=#{uid}")
    void setRole(@Param("roleid")String roleid,
                 @Param("uid")String uid);
}
